package com.settlement.system.common.model;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@RequiredArgsConstructor
public class QyWechatData implements Serializable {
    private String msgtype = "text";
    private MessageData text = new MessageData();

    private MessageData markdown = new MessageData();

    public static QyWechatData Text(String content) {
        QyWechatData data = new QyWechatData();
        data.msgtype = "text";
        data.text.setContent(content);
        data.text.getMentioned_list().add("@all");
        return data;
    }

    public static QyWechatData Markdown(String content) {
        QyWechatData data = new QyWechatData();
        data.msgtype = "markdown";
        data.markdown.setContent(content);
        return data;
    }

    @Data
    static class MessageData implements Serializable {
        private String content;
        private List<String> mentioned_list = new ArrayList<>();
    }
}


